const message = {
  error: function (message, elementId = "#message") {
    const $message = $(elementId);
    $message
      .text(message)
      .removeClass("d-none alert-success")
      .addClass("alert-danger");
    // 滚动到错误消息位置
    $("html, body").animate(
      {
        scrollTop: $message.offset().top - 100,
      },
      500
    );
  },
};

window.message = message;
